package utility;

import java.awt.Graphics;
import java.awt.Image;
import java.io.IOException;
import java.net.URL;
import javax.swing.ImageIcon;


/**
 * Image Tool Box - loading files
 * @author bt
 */
public class ImageToolbox {

    private static ImageToolbox reference;

    public static Image loadImageIconRessource(String filename) throws IOException {
        ImageIcon ii = null;
        System.out.println("fil " + filename);
        // make ressource file with url
        URL url = reference.getClass().getClassLoader().getResource(filename);

        // create bufferedImage
        if (url != null) {
            ii = new ImageIcon(url);
        }

        return ii.getImage();
    }

   public static void drawImage(Graphics g, ImageIcon imageIcon, int startX, int startY, int sizeX, int sizeY){
       g.drawImage(imageIcon.getImage(), startX, startY, sizeX, sizeY, null);
   }
}
